module z {
	export class tree2 extends eui.Component implements eui.UIComponent {
		private group1: eui.Group;
		private group2: eui.Group;

		private item: number = 9;
		private num: number = 24;
		private isreverse: boolean = false;
		public constructor() {
			super();
		}

		protected partAdded(partName: string, instance: any): void {
			super.partAdded(partName, instance);
		}

		protected childrenCreated(): void {
			super.childrenCreated();

			this.group1.$children.forEach(element => {
				let label: eui.Label = <eui.Label>element;
				label.bold = true;
				label.fontFamily = "fz";
				label.size = 45;
			});
			this.group2.$children.forEach(element => {
				let label: eui.Label = <eui.Label>element;
				label.bold = true;
				label.fontFamily = "fz";
				label.size = 45;
			});
		}


		fastgo() {
			this.item=88

		}

		err() {
	this.item=9
		}
		auto() {
			setInterval(() => {
				this.f5()
				this.group1.y += this.item;
				this.group2.y += this.item;
			}, 30)

		}

		ok() {

		}
		stop() {
			return 1

		}


		private f5() {
			if (this.isreverse == false) {
				this.group1.$children.reverse()
				this.group2.$children.reverse()
				this.isreverse = true
			}


			if (this.group1.y >= 1080) {
				this.group1.y = this.group2.y - 1080;
				for (let i = 0; i < this.group1.numChildren; i++) {
					let a: eui.Label = <eui.Label>this.group1.getChildAt(i)
					a.text = this.num + "";
					this.num += 1;

				}

			}
			if (this.group2.y >= 1080) {
				this.group2.y = this.group1.y - 1080;
				for (let i = 0; i < this.group2.numChildren; i++) {
					let a: eui.Label = <eui.Label>this.group2.getChildAt(i)
					a.text = this.num + "";
					this.num += 1;

				}

			}

		}

	}
}